import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server:{
    port: 3001
  },
  build: {
    outDir: 'dist',
    lib: {
      entry: path.resolve(__dirname, './src/components/index.ts'),
      name: 'my-pips',
      formats: ['es','umd','cjs'],
      fileName: (format)=>`my-pips.${format}.js`
    },
    rollupOptions: {
      external: ['vue'],
      output: {
        // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
        globals:{
          vue: 'Vue'
        }
      }
    }
  }
})
